-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provider: Convert and enforce most data sources to AWS Go SDK pointer conversion functions during conditionals #17718
Conversation
… conversion functions during conditionals Reference: #12992 This work is being done in chunks to reduce review burden. Avoiding `aws_route` and `aws_route_table` data sources due to large pull requests pending review. Previously: ``` aws/data_source_aws_acm_certificate.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 86: if *cert.DomainName == target { -------------------------------------------------------------------------------- 128: if *certificate.Type == *certType { -------------------------------------------------------------------------------- 188: if *i.Status != *j.Status { -------------------------------------------------------------------------------- 192: if *i.Status == acm.CertificateStatusIssued { aws/data_source_aws_ami_ids.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 85: if image.Name == nil || *image.Name == "" { aws/data_source_aws_api_gateway_rest_api.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 151: if *item.Path == "/" { aws/data_source_aws_cloudfront_cache_policy.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 176: if *policySummary.CachePolicy.CachePolicyConfig.Name == d.Get("name").(string) { aws/data_source_aws_cloudfront_origin_request_policy.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 151: if *policySummary.OriginRequestPolicy.OriginRequestPolicyConfig.Name == d.Get("name").(string) { aws/data_source_aws_ebs_default_kms_key_test.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 47: if attr != *actual.KmsKeyId { aws/data_source_aws_ebs_encryption_by_default_test.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 48: if attr != *actual.EbsEncryptionByDefault { aws/data_source_aws_elasticache_cluster.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 190: if *cluster.NotificationConfiguration.TopicStatus == "active" { aws/data_source_aws_iam_server_certificate_test.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 32: if *certs[0].ServerCertificateName != "latest" { aws/data_source_aws_instance.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 391: if instance.State != nil && *instance.State.Name != "terminated" { -------------------------------------------------------------------------------- 478: if *ni.Attachment.DeviceIndex == 0 { -------------------------------------------------------------------------------- 500: if instance.SubnetId != nil && *instance.SubnetId != "" { aws/data_source_aws_kms_alias.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 46: if *entity.AliasName == target { aws/data_source_aws_lb_listener.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 286: if *listener.Port == int64(port.(int)) { aws/data_source_aws_nat_gateway.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 133: if *address.AllocationId != "" { aws/data_source_aws_sfn_state_machine.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 55: if *sm.Name == target { aws/data_source_aws_ssm_patch_baseline.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 85: if v.(string) == *baseline.OperatingSystem { aws/data_source_aws_subnet.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 178: if *a.Ipv6CidrBlockState.State == "associated" { //we can only ever have 1 IPv6 block associated at once aws/data_source_aws_workspaces_image_test.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 70: if *resp.Images[0].ImageId != rs.Primary.ID { ``` Output from acceptance testing: ``` --- FAIL: TestAccAWSAcmCertificateDataSource_multipleIssued (2.76s) # #17404 --- FAIL: TestAccAWSAcmCertificateDataSource_singleIssued (9.02s) # #17404 --- PASS: TestAccAWSAcmCertificateDataSource_KeyTypes (22.58s) --- PASS: TestAccAWSAcmCertificateDataSource_noMatchReturnsError (14.61s) --- PASS: TestAccAWSCloudFrontDataSourceCachePolicy_basic (20.71s) --- PASS: TestAccAWSCloudFrontDataSourceOriginRequestPolicy_basic (18.62s) --- PASS: TestAccAWSDataElasticacheCluster_basic (690.01s) --- PASS: TestAccAWSInstanceDataSource_AzUserData (89.39s) --- PASS: TestAccAWSInstanceDataSource_basic (105.68s) --- PASS: TestAccAWSInstanceDataSource_blockDevices (109.08s) --- PASS: TestAccAWSInstanceDataSource_blockDeviceTags (111.04s) --- PASS: TestAccAWSInstanceDataSource_creditSpecification (92.40s) --- PASS: TestAccAWSInstanceDataSource_EbsBlockDevice_KmsKeyId (111.12s) --- PASS: TestAccAWSInstanceDataSource_enclaveOptions (119.23s) --- PASS: TestAccAWSInstanceDataSource_getPasswordData_falseToTrue (169.44s) --- PASS: TestAccAWSInstanceDataSource_getPasswordData_trueToFalse (200.88s) --- PASS: TestAccAWSInstanceDataSource_GetUserData (178.11s) --- PASS: TestAccAWSInstanceDataSource_GetUserData_NoUserData (174.80s) --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (100.39s) --- PASS: TestAccAWSInstanceDataSource_gp3ThroughputDevice (87.80s) --- PASS: TestAccAWSInstanceDataSource_keyPair (89.11s) --- PASS: TestAccAWSInstanceDataSource_metadataOptions (130.64s) --- PASS: TestAccAWSInstanceDataSource_PlacementGroup (82.19s) --- PASS: TestAccAWSInstanceDataSource_privateIP (92.96s) --- PASS: TestAccAWSInstanceDataSource_RootBlockDevice_KmsKeyId (135.66s) --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (90.25s) --- PASS: TestAccAWSInstanceDataSource_secondaryPrivateIPs (93.10s) --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (103.29s) --- PASS: TestAccAWSInstanceDataSource_tags (98.98s) --- PASS: TestAccAWSInstanceDataSource_VPC (109.26s) --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (105.95s) --- PASS: TestAccAWSSsmPatchBaselineDataSource_existingBaseline (19.45s) --- PASS: TestAccAWSSsmPatchBaselineDataSource_newBaseline (22.38s) --- PASS: TestAccDataSourceAwsAmiIds_basic (16.91s) --- PASS: TestAccDataSourceAwsAmiIds_sorted (37.67s) --- PASS: TestAccDataSourceAwsApiGatewayRestApi_basic (16.62s) --- PASS: TestAccDataSourceAwsApiGatewayRestApi_EndpointConfiguration_VpcEndpointIds (200.16s) --- PASS: TestAccDataSourceAwsEBSDefaultKmsKey_basic (19.55s) --- PASS: TestAccDataSourceAwsEBSEncryptionByDefault_basic (10.56s) --- PASS: TestAccDataSourceAwsKmsAlias_AwsService (12.84s) --- PASS: TestAccDataSourceAwsKmsAlias_CMK (19.43s) --- PASS: TestAccDataSourceAWSLBListener_BackwardsCompatibility (196.24s) --- PASS: TestAccDataSourceAWSLBListener_basic (186.19s) --- PASS: TestAccDataSourceAWSLBListener_DefaultAction_Forward (183.04s) --- PASS: TestAccDataSourceAWSLBListener_https (187.24s) --- PASS: TestAccDataSourceAwsNatGateway_basic (208.03s) --- PASS: TestAccDataSourceAwsSfnStateMachine_basic (49.83s) --- PASS: TestAccDataSourceAwsSubnet_basic (34.58s) --- PASS: TestAccDataSourceAwsSubnet_ipv6ByIpv6CidrBlock (58.30s) --- PASS: TestAccDataSourceAwsSubnet_ipv6ByIpv6Filter (85.44s) --- SKIP: TestAccDataSourceAwsWorkspacesImage_basic (0.76s) ```
7f1c845
to
57260c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
GovCloud:
--- FAIL: TestAccAWSAcmCertificateDataSource_multipleIssued (2.40s) (expected)
--- FAIL: TestAccAWSAcmCertificateDataSource_singleIssued (10.78s) (expected)
--- FAIL: TestAccAWSInstanceDataSource_enclaveOptions (17.75s) (expected)
--- FAIL: TestAccDataSourceAWSLBListener_https (187.07s) (expected)
--- PASS: TestAccAWSAcmCertificateDataSource_KeyTypes (20.29s)
--- PASS: TestAccAWSAcmCertificateDataSource_noMatchReturnsError (13.24s)
--- PASS: TestAccAWSDataElasticacheCluster_basic (637.86s)
--- PASS: TestAccAWSInstanceDataSource_AzUserData (81.12s)
--- PASS: TestAccAWSInstanceDataSource_basic (94.41s)
--- PASS: TestAccAWSInstanceDataSource_blockDevices (90.79s)
--- PASS: TestAccAWSInstanceDataSource_blockDeviceTags (108.22s)
--- PASS: TestAccAWSInstanceDataSource_creditSpecification (94.16s)
--- PASS: TestAccAWSInstanceDataSource_EbsBlockDevice_KmsKeyId (86.93s)
--- PASS: TestAccAWSInstanceDataSource_getPasswordData_falseToTrue (170.11s)
--- PASS: TestAccAWSInstanceDataSource_getPasswordData_trueToFalse (199.60s)
--- PASS: TestAccAWSInstanceDataSource_GetUserData (189.23s)
--- PASS: TestAccAWSInstanceDataSource_GetUserData_NoUserData (169.94s)
--- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (109.06s)
--- PASS: TestAccAWSInstanceDataSource_gp3ThroughputDevice (77.23s)
--- PASS: TestAccAWSInstanceDataSource_keyPair (106.04s)
--- PASS: TestAccAWSInstanceDataSource_metadataOptions (105.57s)
--- PASS: TestAccAWSInstanceDataSource_PlacementGroup (72.28s)
--- PASS: TestAccAWSInstanceDataSource_privateIP (104.61s)
--- PASS: TestAccAWSInstanceDataSource_RootBlockDevice_KmsKeyId (117.80s)
--- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (84.14s)
--- PASS: TestAccAWSInstanceDataSource_secondaryPrivateIPs (104.80s)
--- PASS: TestAccAWSInstanceDataSource_SecurityGroups (98.76s)
--- PASS: TestAccAWSInstanceDataSource_tags (85.88s)
--- PASS: TestAccAWSInstanceDataSource_VPC (104.88s)
--- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (106.17s)
--- PASS: TestAccAWSSsmPatchBaselineDataSource_existingBaseline (22.67s)
--- PASS: TestAccAWSSsmPatchBaselineDataSource_newBaseline (24.99s)
--- PASS: TestAccDataSourceAwsAmiIds_basic (13.35s)
--- PASS: TestAccDataSourceAwsAmiIds_sorted (34.66s)
--- PASS: TestAccDataSourceAwsApiGatewayRestApi_EndpointConfiguration_VpcEndpointIds (159.06s)
--- PASS: TestAccDataSourceAwsEBSDefaultKmsKey_basic (13.52s)
--- PASS: TestAccDataSourceAwsEBSEncryptionByDefault_basic (13.58s)
--- PASS: TestAccDataSourceAwsKmsAlias_AwsService (15.28s)
--- PASS: TestAccDataSourceAwsKmsAlias_CMK (29.35s)
--- PASS: TestAccDataSourceAWSLBListener_BackwardsCompatibility (193.48s)
--- PASS: TestAccDataSourceAWSLBListener_basic (196.39s)
--- PASS: TestAccDataSourceAWSLBListener_DefaultAction_Forward (163.19s)
--- PASS: TestAccDataSourceAwsNatGateway_basic (227.49s)
--- PASS: TestAccDataSourceAwsSfnStateMachine_basic (76.12s)
--- PASS: TestAccDataSourceAwsSubnet_basic (36.53s)
--- PASS: TestAccDataSourceAwsSubnet_ipv6ByIpv6CidrBlock (60.78s)
--- PASS: TestAccDataSourceAwsSubnet_ipv6ByIpv6Filter (60.85s)
--- SKIP: TestAccAWSCloudFrontDataSourceCachePolicy_basic (0.00s)
--- SKIP: TestAccAWSCloudFrontDataSourceOriginRequestPolicy_basic (0.00s)
--- SKIP: TestAccDataSourceAwsApiGatewayRestApi_basic (0.00s)
--- SKIP: TestAccDataSourceAwsWorkspacesImage_basic (1.34s)
us-west-2
:
--- FAIL: TestAccAWSAcmCertificateDataSource_multipleIssued (3.00s)
--- FAIL: TestAccAWSAcmCertificateDataSource_singleIssued (6.67s)
--- PASS: TestAccAWSAcmCertificateDataSource_KeyTypes (22.55s)
--- PASS: TestAccAWSAcmCertificateDataSource_noMatchReturnsError (15.35s)
--- PASS: TestAccAWSCloudFrontDataSourceCachePolicy_basic (10.94s)
--- PASS: TestAccAWSCloudFrontDataSourceOriginRequestPolicy_basic (9.97s)
--- PASS: TestAccAWSDataElasticacheCluster_basic (615.80s)
--- PASS: TestAccAWSInstanceDataSource_AzUserData (94.18s)
--- PASS: TestAccAWSInstanceDataSource_basic (97.43s)
--- PASS: TestAccAWSInstanceDataSource_blockDevices (73.74s)
--- PASS: TestAccAWSInstanceDataSource_blockDeviceTags (71.19s)
--- PASS: TestAccAWSInstanceDataSource_creditSpecification (96.49s)
--- PASS: TestAccAWSInstanceDataSource_EbsBlockDevice_KmsKeyId (77.30s)
--- PASS: TestAccAWSInstanceDataSource_enclaveOptions (139.84s)
--- PASS: TestAccAWSInstanceDataSource_getPasswordData_falseToTrue (216.95s)
--- PASS: TestAccAWSInstanceDataSource_getPasswordData_trueToFalse (239.78s)
--- PASS: TestAccAWSInstanceDataSource_GetUserData (183.47s)
--- PASS: TestAccAWSInstanceDataSource_GetUserData_NoUserData (167.14s)
--- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (116.16s)
--- PASS: TestAccAWSInstanceDataSource_gp3ThroughputDevice (105.78s)
--- PASS: TestAccAWSInstanceDataSource_keyPair (200.73s)
--- PASS: TestAccAWSInstanceDataSource_metadataOptions (121.39s)
--- PASS: TestAccAWSInstanceDataSource_PlacementGroup (133.88s)
--- PASS: TestAccAWSInstanceDataSource_privateIP (94.28s)
--- PASS: TestAccAWSInstanceDataSource_RootBlockDevice_KmsKeyId (134.64s)
--- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (104.94s)
--- PASS: TestAccAWSInstanceDataSource_secondaryPrivateIPs (103.37s)
--- PASS: TestAccAWSInstanceDataSource_SecurityGroups (108.21s)
--- PASS: TestAccAWSInstanceDataSource_tags (83.41s)
--- PASS: TestAccAWSInstanceDataSource_VPC (111.33s)
--- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (116.15s)
--- PASS: TestAccAWSSsmPatchBaselineDataSource_existingBaseline (16.12s)
--- PASS: TestAccAWSSsmPatchBaselineDataSource_newBaseline (17.55s)
--- PASS: TestAccDataSourceAwsAmiIds_basic (11.66s)
--- PASS: TestAccDataSourceAwsAmiIds_sorted (34.66s)
--- PASS: TestAccDataSourceAwsApiGatewayRestApi_basic (13.33s)
--- PASS: TestAccDataSourceAwsApiGatewayRestApi_EndpointConfiguration_VpcEndpointIds (241.84s)
--- PASS: TestAccDataSourceAwsEBSDefaultKmsKey_basic (10.40s)
--- PASS: TestAccDataSourceAwsEBSEncryptionByDefault_basic (10.36s)
--- PASS: TestAccDataSourceAwsKmsAlias_AwsService (17.43s)
--- PASS: TestAccDataSourceAwsKmsAlias_CMK (22.31s)
--- PASS: TestAccDataSourceAWSLBListener_BackwardsCompatibility (190.81s)
--- PASS: TestAccDataSourceAWSLBListener_basic (179.32s)
--- PASS: TestAccDataSourceAWSLBListener_DefaultAction_Forward (166.98s)
--- PASS: TestAccDataSourceAWSLBListener_https (181.95s)
--- PASS: TestAccDataSourceAwsNatGateway_basic (192.51s)
--- PASS: TestAccDataSourceAwsSfnStateMachine_basic (87.71s)
--- PASS: TestAccDataSourceAwsSubnet_basic (29.61s)
--- PASS: TestAccDataSourceAwsSubnet_ipv6ByIpv6CidrBlock (50.12s)
--- PASS: TestAccDataSourceAwsSubnet_ipv6ByIpv6Filter (50.25s)
--- SKIP: TestAccDataSourceAwsWorkspacesImage_basic (0.82s)
This has been released in version 3.32.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Reference: #12992
This work is being done in chunks to reduce review burden. Avoiding
aws_route
andaws_route_table
data sources due to large pull requests pending review.Previously:
Output from acceptance testing: